<!--_meta 作为公共模版分离出去-->
<!DOCTYPE HTML>
<html>
<head>
<#include "head.html">
<title>新闻爬虫</title>
</head>
<body>
<article class="page-container">
	<form action="${contextPath}/news/gather.do" method="post" class="form form-horizontal" id="form">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">网页地址：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" required  name="url">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">编码：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<select  name="charset">
					<option value="gbk">gbk</option>
				</select>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">抓取的链接：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" required  name="prefix">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">标题记号：</label>
			<div class="formControls col-xs-8 col-sm-9">
				 <select  name="titleMark">
					<option value="1">title</option>
					<option value="2">tagName</option>
					<option value="3">class</option>
				</select>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">标题正则：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<select  name="titleRegex">
					<option value=""></option>
				</select>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">内容记号：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<select  name="contentMark">
					<option value="1">id</option>
					<option value="2">tagName</option>
					<option value="3">class</option>
				</select>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">内容正则：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<select  name="contentRegex">
					<option value="endText">endText</option>
				</select>
			</div>
		</div>
		
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
				<input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
			</div>
		</div>
	</form>
</article>

<#include "footer.html">

<!--请在下方写此页面业务相关的脚本--> 
<script type="text/javascript">
$(function(){
    $('.skin-minimal input').iCheck({
        checkboxClass: 'icheckbox-blue',
        radioClass: 'iradio-blue',
        increaseArea: '20%'
    })

	$("#form").validate({
		rules:{
		},
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		submitHandler:function(form){
			var options = {  
					url:$("#form").attr("action"),
	                success: function(data) {
	                	if(data=="success"){
	                		layer.alert('抓取成功', function(index){
		  	                	var index = parent.layer.getFrameIndex(window.name);
		  	        			parent.$("[name='refresh']").click();
		  	        			window.location.href="/news/golist.do";
		                	});
	                	}else{
	                		layer.alert('抓取失败', function(index){
	                			var index = parent.layer.getFrameIndex(window.name);
		  	        			parent.$("[name='refresh']").click();
		  	        			location.reload();
	                		});
	                	}
	                }   
	        }; 
			$(form).ajaxSubmit(options);
		}
	});
});
</script> 
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>